﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace SmsSend
{
    public partial class SendHistoryList : UserControl
    {
        public SendHistoryList()
        {
            InitializeComponent();
        }

        private void sousu_btn_Click(object sender, EventArgs e)
        {

        }
        private void BindData(ref DataGridView bdsGrade)
        {
            

            DataTable m_GradeTable = new DataTable();
            m_GradeTable.Columns.Add("BianHao", typeof(string));
            m_GradeTable.Columns.Add("QunFaNeiRong", typeof(string));
            m_GradeTable.Columns.Add("KouFeiJiLu", typeof(string));
            m_GradeTable.Columns.Add("FaSongLeiXing", typeof(string));
            m_GradeTable.Columns.Add("QunFaShiJian", typeof(string));
            for (int i = 0; i < 100; i++)
            {
                m_GradeTable.Rows.Add(new string[] { "编号"+i.ToString(), "元旦快乐"+i.ToString(),  "0."+ i.ToString() +"元","短信",DateTime.Now.ToString() });
            }
            
            
            bdsGrade.DataSource = m_GradeTable;
            
        }

        private void SendHistoryList_Load(object sender, EventArgs e)
        {
            BindData(ref dataGridView1);
            //dataGridView1.Width = 5000
;
            dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);

        }

        private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            dataGridView1.Columns["BianHao"].HeaderText = "编号"; 
            dataGridView1.Columns["QunFaNeiRong"].HeaderText = "群发内容";
            dataGridView1.Columns["KouFeiJiLu"].HeaderText = "扣费记录";
            dataGridView1.Columns["FaSongLeiXing"].HeaderText = "发送类型";
            dataGridView1.Columns["QunFaShiJian"].HeaderText = "扣费时间";
            


        }

        /// <summary>
        /// HeaderCell的设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {            
            if (e.ColumnIndex == this.dataGridView1.Columns["BianHao"].Index)//根据班级设置行样式
            {
                DataGridViewRow CurrentRow = this.dataGridView1.Rows[e.RowIndex];
                CurrentRow.HeaderCell.Value = Convert.ToString(e.RowIndex + 1);//显示行号，也可以设置成显示其他信息                
                CurrentRow.HeaderCell.ToolTipText = "当前第" + Convert.ToString(e.RowIndex + 1) + "行";//设置ToolTip信息               
            }
        }

    }
}





